﻿using System;
using LeonardoNews.Models;

namespace LeonardoNews.Server.Models.ArticleModels
{
    public class VoteModel
    {
        public int ID { get; set; }

        public virtual UserModel User { get; set; }

        public int State { get; set; }

        public static VoteModel FromVote(Vote vote)
        {
            return new VoteModel()
            {
                ID = vote.ID,
                User = vote.User == null ? null : UserModel.FromUser(vote.User),
                State = vote.State
            };
        }
    }
}